﻿using EPiServer.Data.Dynamic;
using EPiServer.DataAbstraction;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;

namespace EPiServer.DdsPageProvider
{
    [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
    public class Initializer : IInitializableModule
    {
        #region IInitializableModule Members

        public void Initialize(InitializationEngine context)
        {
            EPiServer.DataFactory.Instance.ProviderMap.Iterate((pp) =>
            {
                if (pp is DdsPageProvider)
                    (pp as DdsPageProvider).Initialize(DynamicDataStoreFactory.Instance, PageType.List);
            });
        }

        public bool IsInitialized { get; set; }

        public void Preload(string[] parameters)
        {
        }

        public void Uninitialize(InitializationEngine context)
        {
        }

        #endregion
    }
}
